home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_325 / fam / low-mem.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  117 lines

  1. /*
  2. **    :ts=8
  3. **
  4. **    low-mem.h
  5. **
  6. **    Copyright 1987 By ASDG Incorporated - All Rights Reserved
  7. **    May  be  freely redistributed for non-commercial purposes
  8. **    provided this  message    retains intact. Available for use
  9. **    in commercial  products for VERY minimal concession. Con-
  10. **    tact ASDG Incorporated at  (201) 563-0529. Use in commer-
  11. **    cial products without  authorization of ASDG Incorporated
  12. **    shall be viewed as copyright infringement and piracy.
  13. **
  14. **    For commercial applications of the low-memory server ASDG
  15. **    will grant perpetual use licenses provided that:
  16. **        a) We are credited  somewhere  in your documenta-
  17. **           tion.
  18. **        b) You send us a copy of the application.
  19. **        c) You pay a  very small  administrative fee  not
  20. **           exceeding $50.
  21. **
  22. **    Author: Perry S. Kivolowitz
  23. */
  24.  
  25. /*
  26. **    To use the low-memory server you must allocate one of these
  27. **    structures.  When a  low memory  condition exists, the low-
  28. **    memory server will look for  the message port you specified
  29. **    in the call to RegLowMemReq.  If the message port is found,
  30. **    the low-memory    server will  examine the LoeMemMsg you sup-
  31. **    plied a pointer to in the call to RegLowMemReq.
  32. **
  33. **    If the low-memory server finds something other than LM_CON-
  34. **    DITION_ACKNOWLEDGED, it will not send you a message. There-
  35. **    fore you should initialize this field with that value.
  36. **
  37. **    This scheme  is  used to  ensure that the low-memory server
  38. **    does not reuse the same LowMemMsg (which you supply).  This
  39. **    scheme allows the low-memory server to not wait for a Reply
  40. **    which could be deadly if none was forthcoming from your ap-
  41. **    plication.
  42. */
  43.  
  44. struct LowMemMsg {
  45.     struct Message lm_msg;
  46.     long lm_flag;
  47. };
  48.  
  49.  
  50. /*
  51. **    values for lm_flag
  52. */
  53.  
  54. #define LM_LOW_MEMORY_CONDITION     0x00000000
  55. #define LM_CONDITION_ACKNOWLEDGED    (('A'<<24)|('S'<<16)|('D'<<8)|'G')
  56.  
  57. /*
  58. **    useful defines as in:
  59. **
  60. **    lmptr = (LMMPtr) AllocMem(SizeOfLMMsg , 0L);
  61. */
  62.  
  63. #define SizeOfLMMsg    sizeof(struct LowMemMsg)
  64. #define LMMPtr        struct LowMemMsg *
  65. #define LMSName     "asdg-low-mem.library"
  66.  
  67. /*
  68. **    Meaning of Error Returns coming back from RegLowMemReq
  69. */
  70.  
  71. #define LM_BADNAME    -1    /* duplication of port name */
  72. #define LM_NOMEM    -2    /* memory allocation failed */
  73.  
  74.  
  75. /******* Following lines added 01-Feb-90 by Darren New to support
  76.      Lattice 5.x, ANSI, etc.    **********************************/
  77.  
  78.  
  79. extern struct Library *LowMemBase;
  80.  
  81.  
  82. extern long RegLowMemReq(char * PortName , LMMPtr Space);
  83. /*
  84. ;    PortName is  a pointer    to a null terminated string representing
  85. ;         the name  of  your port to which the low-memory service
  86. ;         will attempt to send a message.
  87. ;    Space     is a pointer to an initialized LowMemMessage.
  88. ;
  89. ;    res     if false means  your  registration has  been  accepted.
  90. ;         Currently, the only  reason  your  request would be re-
  91. ;         jected is  if    the  low-memory server itself ran out of
  92. ;         memory (oh my!) or the port name  you requested has al-
  93. ;         ready been registered. The value of the returned  error
  94. ;         code can be used to determine why the call failed.
  95. ;
  96. */
  97.  
  98. void DeRegLowMemReq(char * PortName);
  99. /*
  100. ;
  101. ; DeRegLowMemReq
  102. ;
  103. ; Undo the effect of a previous RegLowMemReq. You absolutely positively
  104. ; must call this routine before  exiting  your program (or  closing the
  105. ; library)
  106. ;
  107. ;
  108. */
  109.  
  110. #ifndef  NO_PRAGMAS
  111. /*------ normal functions ---------------------------------------------*/
  112. #pragma libcall LowMemBase RegLowMemReq 1e 9802
  113. #pragma libcall LowMemBase DeRegLowMemReq 24 801
  114. #endif
  115.  
  116.  
  117.